package main

import (
	"fmt"
	"sync"
)

var wg = sync.WaitGroup{}
var num int = 0

func print() {

	for i := 0; i < 1000000; i++ {
		num += 1
	}
	wg.Done()
}
func main() {
	fmt.Println("主进程开始")
	wg.Add(2)
	go print()
	go print()
	wg.Wait()
	fmt.Println("num", num)
	fmt.Println("主进程完成")
}
